Lens.prototype = new Mirror();
function Lens(r, imageFile) {	
	this.rot = r;
	this.imageFile = imageFile;
	this.image = null;

	Lens.prototype.render = function(processing) {
		// load the image file if it hasn't been loaded already
		if (this.image == null) {
			this.image = processing.loadImage(this.imageFile);
		}
		
		processing.pushMatrix();
			
		// translate to the screen position.
		processing.translate(this.px, this.py);
		
		// Draw the mirror's bounding box, which has no rotation information.
		processing.noFill();
		
		// Change the bounding box color if the mirror is selected.
		if (this.isSelected) {
			processing.stroke(0, 255, 0);
		} else if(this.isPlaced) {
			processing.noStroke();
		} else {
			processing.stroke(0, 0, 0);
		}
		
		processing.quad(
			-1 * this.halfLength, this.halfLength,
			this.halfLength, this.halfLength,
			this.halfLength, -1 * this.halfLength,
			-1 * this.halfLength, -1 * this.halfLength
		);
			
		// Draw the mirror itself, which is rotated.
		processing.rotate(processing.radians(this.rot));
		
		// Draw the mirror quad.			
		processing.image(this.image, -1 * this.halfLength, -1 * this.halfLength); 
		processing.popMatrix();	
		
	}	

	Lens.prototype.newLaserAngle = function(vectorX, vectorY, vectorAngle) {
		return this.rot;
	}
}

RightRotator.prototype = new Lens();
function RightRotator(imageFile) {
	this.rot = 0;
	this.imageFile = imageFile;
	
	RightRotator.prototype.newLaserAngle = function(vectorX, vectorY, vectorAngle) {
		return vectorAngle + 90;
	}
}

LeftRotator.prototype = new Lens();
function LeftRotator(imageFile) {
	this.rot = 0;
	this.imageFile = imageFile;
	
	LeftRotator.prototype.newLaserAngle = function(vectorX, vectorY, vectorAngle) {
		return vectorAngle - 90;
	}
}

Reverser.prototype = new Lens();
function Reverser(imageFile) {
	this.rot = 0;
	this.imageFile = imageFile;
	
	Reverser.prototype.newLaserAngle = function(vectorX, vectorY, vectorAngle) {
		return vectorAngle + 180;
	}
}